//
//  UIBarButtonItem.swift
//  Weibo
//
//  Created by 冯毅 on 16/8/8.
//  Copyright © 2016年 冯毅. All rights reserved.
//

import UIKit
extension UIBarButtonItem{
    convenience init(title: String, target: AnyObject?, action: Selector) {
        self.init()
        
        let button = UIButton()
        
        button.setTitle(title, forState: .Normal)
        
        button.setTitleColor(UIColor.grayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        
        button.titleLabel?.font = UIFont.systemFontOfSize(15)
        
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        
        button.sizeToFit()
        
        customView = button
    }
}